<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script>
        function up(x) {
            var a = x.parentNode.parentNode;
            var tr = document.getElementById("tb").getElementsByTagName("tr");
            var temp = "";
            for (var i = 0; i < tr.length; i++) {
                if (a.innerHTML.charAt(13) == tr[i].innerHTML.charAt(13) && i != 1) {
                    temp = a.innerHTML;
                    a.innerHTML = tr[i - 1].innerHTML;
                    tr[i - 1].innerHTML = temp;
                }
            }
        }

        function down(x) {
            var a = x.parentNode.parentNode;
            var tr = document.getElementById("tb").getElementsByTagName("tr");
            var temp = "";
            for (var i = 0; i < tr.length; i++) {
                if (a.innerHTML.charAt(13) == tr[i].innerHTML.charAt(13) && i != tr.length - 1) {
                    temp = a.innerHTML;
                    a.innerHTML = tr[i + 1].innerHTML;
                    tr[i + 1].innerHTML = temp;
                }
            }
        }
    </script>
</head>
<body>
<table id="tb" border="1" cellpadding="0" cellspacing="0" width="30%">
    <tr>
        <th>ID</th>
        <th>姓名</th>
        <th>手机号</th>
        <th>籍贯</th>
        <th>操作</th>
    </tr>
    <tr>
        <td>1</td>
        <td>貂蝉</td>
        <td>15632658496</td>
        <td>锦州</td>
        <td><input type="button" value="↑" onclick="up(this)"/> <input type="button" value="↓" onclick="down(this)"/>
        </td>
    </tr>
    <tr>
        <td>2</td>
        <td>刘备</td>
        <td>15658462578</td>
        <td>蜀中</td>
        <td><input type="button" value="↑" onclick="up(this)"/> <input type="button" value="↓" onclick="down(this)"/>
        </td>
    </tr>
    <tr>
        <td>3</td>
        <td>曹操</td>
        <td>15666666666</td>
        <td>益州</td>
        <td><input type="button" value="↑" onclick="up(this)"/> <input type="button" value="↓" onclick="down(this)"/>
        </td>
    </tr>
    <tr>
        <td>4</td>
        <td>孙权</td>
        <td>15688869153</td>
        <td>荆州</td>
        <td><input type="button" value="↑" onclick="up(this)"/> <input type="button" value="↓" onclick="down(this)"/>
        </td>
    </tr>
</table>
</body>
</html>